<?php
/**
 * http://php.net/manual/en/class.errorexception.php
 *
 * не торопимся подключать
 * */
class ErrorHandler extends Exception {
    protected $severity;

    public function __construct($message, $code, $severity, $filename, $lineno) {
        $this->message = $message;
        $this->code = $code;
        $this->severity = $severity;
        $this->file = $filename;
        $this->line = $lineno;
        //эмм...
        //trigger_error('oops!'.$message);
        error_log(_error(get_class($this).' '.$message,$code,false),3,ERROR_LOG);
    }

    public function getSeverity() {
        return $this->severity;
    }
}
// нельзя это использовать ибо  Execution will stop after the exception_handler is called.
/*
	set_exception_handler("_exception_handler");

	function _exception_handler($e)
	{
		switch (get_class($e)):
			case 'ErrorHandler':
                // do smthng
                error_log( _error($e->getMessage(),$e->getCode(),true), 3, ERROR_LOG );
				break;
			default:
				_error(get_class($e)." thrown within the exception handler. Message: ".$e->getMessage()." on line ".$e->getLine()." at file ".$e->getFile());
				break;
		endswitch;
        return true;
	}
*/
?>